package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum UserEvaluateScore {
	ONE(1,"1星"),
	TWO(2,"2星"),
	THREE(3,"3星"),
	FOUR(4,"4星"),
	FIVES(5,"5星");
	
	private Integer score;
	
	private String text;
	
	private UserEvaluateScore(Integer score,String text){
		this.score = score;
		this.text = text;
	}
	
	public int toIntScore(){
		return this.score;
	}
	
	public String toStringText(){
		return this.text;
	}
	
	public static UserEvaluateScore toScore(int score){
		if(ONE.score == score){
			return UserEvaluateScore.ONE;
		}else if(TWO.score == score){
			return UserEvaluateScore.TWO;
		}else if(THREE.score == score){
			return UserEvaluateScore.THREE;
		}else if(FOUR.score == score){
			return UserEvaluateScore.FOUR;
		}else if(FIVES.score == score){
			return UserEvaluateScore.FIVES;
		}else{
			throw new InvalidArgumentException("Unknown UserEvaluateScore[" + score + "].");
		}
	}
}
